home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / COMPILER / SATHER / !Sather / Library / IO / sa / stream < prev   
Text File  |  1996-04-09  |  2KB  |  40 lines

  1. ---------------------------> Sather 1.1 source file <--------------------------
  2. -- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
  3. -- Copyright (C) 1995, International Computer Science Institute
  4. -- $Id: stream.sa,v 1.2 1996/04/09 10:05:57 borisv Exp $
  5. --
  6. -- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
  7. -- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
  8. -- LICENSE contained in the file: Sather/Doc/License of the
  9. -- Sather distribution. The license is also available from ICSI,
  10. -- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
  11. -------------------------------------------------------------------
  12. abstract class $OSTREAM is
  13.    -- A general output stream. A first stab at streams.  This
  14.    -- abstraction is already useful for routines that might use a file
  15.    -- or a string ( a common choice is whether a routine will write to
  16.    -- stdout or to a string which may then be printed to a file).
  17.    -- 
  18.    -- Usage:
  19.    --    write_to_stream(o: $OUTSTREAM) is
  20.    --        o + "this is a test";
  21.    --    end;
  22.    --    Which can be invoked using:
  23.    --     write_to_stream(FILE::stdout);
  24.    --       or 
  25.    --     s: STR_STREAM := #;
  26.    --     write_to_stream(s);
  27.    --     write_to_stream(s);
  28.    --     s.str then would have two copies of "this is a test" in it.
  29.  
  30.    
  31.    plus(s: $STR);
  32.    -- Append the string "s" to the stream
  33.    
  34.    plus(s: $STR): SAME;
  35.    -- Append the string "s" to the stream and return self
  36.  
  37. end; -- class $OUTSTREAM
  38. -------------------------------------------------------------------
  39.  
  40.